package com.hrs.common.result;

import lombok.Data;

/**
 * @author 计算机系 ITAEM 摆渡人
 * @description
 * @date 2022/11/19 21:22
 */
@Data
public class CodeMsg {
    private int code;
    private String msg;

    public static final CodeMsg SUCCESS = new CodeMsg(200,"成功");
    public static final CodeMsg ERROR = new CodeMsg(400,"失败");
    public static final CodeMsg NOT_LOGIN = new CodeMsg(401,"未登录");
    public static final CodeMsg NOT_HAVE_PRIVILEGES = new CodeMsg(403,"权限不足");
    public static final CodeMsg NOT_FOUND = new CodeMsg(404,"404 NOT FOUND");
    public static final CodeMsg NOT_OPEN = new CodeMsg(405,"此功能已下线");

    public static final CodeMsg SERVER_INTERNAL_ERROR = new CodeMsg(500,"内部服务器错误");
    public static final CodeMsg SERVER_REQUEST_ERROR = new CodeMsg(501,"无法识别请求方法");
    public static final CodeMsg SERVER_BAD_GATEWAY_ERROR = new CodeMsg(502,"Bad Gateway");//WEB服务器故障
    public static final CodeMsg SERVER_SERVICE_UNAVAILABLE_ERROR = new CodeMsg(503,"Service Unavailable");//服务器掉线
    public static final CodeMsg SERVER_GATEWAY_TIME_OUT_ERROR = new CodeMsg(504,"Gateway Time-out");//请求超时
    public static final CodeMsg SERVER_AGREEMENT_ERROR = new CodeMsg(505,"不支持的协议版本");


    public CodeMsg(int code, String msg) {
        this.code = code;
        this.msg = msg;
    }

    public CodeMsg(String msg){
        this.code = ERROR.getCode();
        this.msg = msg;
    }
}
